﻿using GZNest.Biz.IService;
using GZNest.IRepository;
using System.Linq;

namespace GZNest.Biz.Service
{
    public abstract class BaseService<T> : IBaseService<T> where T : class
    {
        protected IBaseRepository<T> CurrentRepository { get; set; }

        public BaseService(IBaseRepository<T> currentRepository) { CurrentRepository = currentRepository; }

        public T Add(T entity) { return CurrentRepository.Add(entity); }

        public bool Update(T entity) { return CurrentRepository.Update(entity); }

        public bool Delete(T entity) { return CurrentRepository.Delete(entity); }

        public IQueryable<T> FindAll() { return CurrentRepository.FindAll(); }
    }

}
